php count occurrences of string in array

112

$array = array('', '', 'other', '', 'other');

$counter = 0;
foreach($array as $value)
{
  if($value === '')
    $counter++;
}
echo $counter;

Comments

Submit
0 Comments